< previous page page_127 next page >

Page 127
3. To add an image to the ImageList control, click the Insert Picture button. This action presents you with the Select Picture dialog box, from which you can choose the bitmap or icon you want. As you select the picture, it is added to the control and displayed in the Images area.
4. After you add all the pictures you might need, click the OK button to close the dialog box.
note.gif Many sample icons and bitmaps are included with Visual Basic. If you installed them, they are located in a subdirectory called Graphics (the location of this directory depends on which installation options you chose, and whether you installed just Visual Basic or the entire Visual Studio suite). square.gif

After you complete these steps, your ImageList control is ready to use for supplying images to your toolbar.
Creating a Standard Toolbar
To use the standard ToolBar control, you first need to position it on a form. To do so, follow these steps:
1. Draw the ToolBar control on your form. Visual Basic positions the toolbar at the top of the form, and the control spans the width of the form.
2. Set the toolbar's alignment. A toolbar can be aligned along any of the four edges of its form or float freely:
d6ef40187df115e88326dbc94f09ab9a.gif
To position the toolbar along the top of your form, leave the Align property set at its 1 vbAlignTop default setting.
d6ef40187df115e88326dbc94f09ab9a.gif
To position it along the bottom of your form, set its Align property to 2 - vbAlignBottom.
d6ef40187df115e88326dbc94f09ab9a.gif
To align it to the left or right edge of the form, set the Align property to 3 - vbAlignLeft or 4 - vbAlignRight, respectively. In these cases, you should adjust the Width property to keep it from filling the form completely.
d6ef40187df115e88326dbc94f09ab9a.gif
To use a free-floating toolbar, set its Align property to 0 vbAlignNone. You can adjust the toolbar's position and size by setting the Left, Top, Width, and Height properties.
3. Open the ToolBar control's Property Pages dialog box by right-clicking the control and choosing Properties. Figure 6.14 shows the first page of the ToolBar control's Property Pages.
4. Set the ToolBar control's ImageList property to the name of the ImageList control that you already set up to provide images. Clicking the arrow to the right of the ImageList property provides you with a list of all ImageList controls on the current form.

 
< previous page page_127 next page >